package com.tourlaid.mamagerment.action.pc

import com.tourlaid.mamagerment.ao.pc.LoginAo
import com.tourlaid.mamagerment.entity.ResponseData
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * Created by xiaoyongge on 2017/7/20.
 */
@RestController
@RequestMapping("/tld/pub/login")
class LoginAction {

    @Autowired
    private val loginAo: LoginAo? = null

    @RequestMapping("/loginIn.json")
    fun loginIn(account: String?, password: String?, callback: String): String {
        val userId = loginAo!!.loginIn(account, password);
        return ResponseData(userId).toJson(callback)
    }

    @RequestMapping("/adminRegister.json")
    fun adminRegister(account: String?, password: String?): ResponseData<Long> {
        val userId = loginAo!!.adminRegister(account, password);
        return ResponseData(userId)
    }
}